package Traductor;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.List;

public class CInstruccionIO {
	
	public void guardarInstrucciones(List<CInstruccion> cod, String filename) throws IOException{
		FileOutputStream file = new FileOutputStream(filename);
		ObjectOutputStream object = new ObjectOutputStream(file);
		object.writeObject(cod);
	}
	
	public List<CInstruccion> leerInstrucciones(String filename) throws IOException, ClassNotFoundException{
		FileInputStream file = new FileInputStream(filename);
		ObjectInputStream object = new ObjectInputStream(file); 
		List<CInstruccion> cod = (List<CInstruccion>) object.readObject();
		return cod;
	}
}
